

**************************************************************************************
*** Replication for analyses in "Violent conflict and the demand for healthcare:   ***
*** How armed conflict reduces trust, instills fear, and increases child mortality ***
*** Publication: Social Science & Medicine
*** Author: Max Schaub, University of Hamburg and WZB Berlin Social Science Center ***
**************************************************************************************


//// Setup ////

// Install packages

ssc install estout, replace // thanks to Ben Jann 
ssc install reghdfe, replace // thanks to Sergio Correia and Noah Constantine
ssc install did2s, replace // thanks to Kyle Butts


// Set working directory 

cd "..."


// Control variables
global controls gender age10 edu employment nightlights ipmarketaccess ipstatereach ipspei pop ipedufem latitude longitude  


//// Results ////


// Figure 1

* see R script "Figure_1.R"


// Figure 2

use "Violent_Conflict_Healthcare_Grid.dta", clear

twoway (lpolyci mortU1 year if ucdpdeathsbin==0,  bw(1)) ///
		(lpolyci mortU1  year if ucdpdeathsbin==1,  bw(1) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Infant mortality rate")  ylabel(.045(0.005)0.07, nogrid format(%04.3f)) xtitle("") xlabel(2005(2)2015) ///
		name(mortU1_ucdp, replace))
graph display mortU1_ucdp, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci dpt3cov year if ucdpdeathsbin==0,  bw(1)) ///
		(lpolyci dpt3cov  year if ucdpdeathsbin==1,  bw(1) ///
		legend(pos(4) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)		///
		ytitle("DPT3 vaccination rate")  ylabel(.5(0.05).75, nogrid format(%03.2f)) xtitle("") xlabel(2005(2)2015) ///
		name(dpt3cov_ucdp, replace))
graph display dpt3cov_ucdp, ysize(1.25) xsize(1) scale(1.1) 


use "Violent_Conflict_Healthcare_Ind.dta", clear

twoway (lpolyci fear_violence  year if ucdpdeathsbin==0,  bw(3)) ///
		(lpolyci fear_violence  year if ucdpdeathsbin==1,  bw(3) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Fear of violence")  ylabel(.6(0.1)1.1, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(fear_ucdp, replace))
graph display fear_ucdp, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci tpol  year if ucdpdeathsbin==0,  bw(3)) ///
		(lpolyci tpol  year if ucdpdeathsbin==1,  bw(3) ///
		legend(pos(4) ring(0) col(1) order(2 "No armed violence" 4 "Exposed to armed violence" ) size(small)) lpattern(dash) ///
		ytitle("Political trust")  ylabel(1.2(0.1)1.7, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(pol_trust_ucdp, replace))
graph display pol_trust_ucdp, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci meduse  year if ucdpdeathsbin==0,  bw(3)) ///
		(lpolyci meduse  year if ucdpdeathsbin==1,  bw(3) ///
		legend(pos(4) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small))	lpattern(dash)	///
		ytitle("Frequency of healthcare use")  ylabel(2.7(0.1)3.2, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(meduse_ucdp, replace))
graph display meduse_ucdp, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci fear_violence  year if attackbin==0,  bw(3)) ///
		(lpolyci fear_violence  year if attackbin==1,  bw(3) ///
		legend(pos(1) ring(0) col(1) lab(2 "Not victimized") lab(4 "Physically attacked") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Fear of violence")  ylabel(.5(0.3)2, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(fear_attack, replace))
graph display fear_attack, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci tpol year if attackbin==0,  bw(3)) ///
		(lpolyci tpol year if attackbin==1,  bw(3) ///
		legend(pos(4) ring(0) col(1) lab(2 "Not victimized") lab(4 "Physically attacked") order(2 4) size(small)) lpattern(dash) ///
		ytitle("Political trust")  ylabel(1.3(0.1)1.8, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(pol_trust_attack, replace))
graph display pol_trust_attack, ysize(1.25) xsize(1) scale(1.1) 

twoway (lpolyci meduse  year if attackbin==0,  bw(3)) ///
		(lpolyci meduse  year if attackbin==1,  bw(3) ///
		legend(pos(4) ring(0) col(1) lab(2 "Not victimized") lab(4 "Physically attacked") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Frequency of healthcare use")  ylabel(2.6(0.1)3.1, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(meduse_attack, replace))
graph display meduse_attack, ysize(1.25) xsize(1) scale(1.1) 


// Figure 3

sembuilder "sem_ucdp.stsem"

sembuilder "sem_attack.stsem"


// Table 1

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo trust_ucdp: 			reghdfe tpol ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust_attack: 		reghdfe tpol physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_trust: 	reghdfe meduse100 tpol $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace	 
eststo dpt3cov_trust: 		mixed dpt3cov100 tpol  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_healthcare: 	mixed mortU1100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_dpt3cov: 	mixed mortU1100 dpt3cov  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust_ucdp fear_ucdp trust_attack fear_attack wohealthc_fear wohealthc_trust dpt3cov_trust mortU1_healthcare mortU1_dpt3cov,  ///
	keep(ucdpdeathsbin physically_attacked tpol fear_violence meduse1 dpt3cov) ///
	order(ucdpdeathsbin physically_attacked tpol meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01)  ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(controls N nunits, fmt(%3s %9.0gc %9.0gc) label("Controls" "N observations" "N fixed/random effects")) replace 


// Table 2

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo did2s_trust: did2s tpol, first_stage($controls i.gid i.year) second_stage(ucdpdeathsbin) treatment(ny_treated_t) cluster(id) 
estadd local controls "Yes", replace
eststo did2s_fear: did2s fear_violence, first_stage($controls i.gid i.year) second_stage(ucdpdeathsbin ) treatment(ny_treated_t) cluster(id)
estadd local controls "Yes", replace
esttab did2s_trust did2s_fear,  ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(controls N nunits, fmt(%3s %9.0gc %9.0gc) label("Controls" "N observations" "N fixed effects")) replace 

		
// Table 3

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo med_fear_ucdp: mediate (meduse $controls i.year) (fear_violence $controls tpol i.year) (ucdpdeathsbin), coefl vce(cluster gid)
eststo share_fear_ucdp: nlcom _b[NIE:r1vs0.ucdpdeathsbin]/_b[TE:r1vs0.ucdpdeathsbin],  post
eststo med_trust_ucdp: mediate (meduse $controls  i.year) (tpol $controls fear_violence i.year) (ucdpdeathsbin),  vce(cluster gid)
eststo share_trust_ucdp: nlcom _b[NIE:r1vs0.ucdpdeathsbin]/_b[TE:r1vs0.ucdpdeathsbin],  post

esttab med_fear_ucdp med_trust_ucdp,  keep(NIE:r1vs0.ucdpdeathsbin TE:r1vs0.ucdpdeathsbin) varwidth(25) wrap star(* 0.1 ** 0.05 *** 0.01)  ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N, fmt(%9.0gc %9.2gc) label("N")) coefl(NIE:r1vs0.ucdpdeathsbin "Nat. indirect effect" TE:r1vs0.ucdpdeathsbin "Total effect") replace tex
esttab share_fear_ucdp share_trust_ucdp, cells(b(fmt(2))) varwidth(25) noobs coefl(_nl_1  "Proportion mediated") tex

eststo med_fear_attack: mediate (meduse $controls i.year) (fear_violence $controls tpol i.year) (attackbin), coefl vce(cluster gid)
eststo share_fear_attack: nlcom _b[NIE:r1vs0.attackbin]/_b[TE:r1vs0.attackbin],  post
eststo med_trust_attack: mediate (meduse $controls  i.year) (tpol $controls fear_violence i.year) (attackbin),  vce(cluster gid)
eststo share_trust_attack: nlcom _b[NIE:r1vs0.attackbin]/_b[TE:r1vs0.attackbin],  post

esttab med_fear_attack med_trust_attack,  keep(NIE:r1vs0.attackbin TE:r1vs0.attackbin) varwidth(25) wrap star(* 0.1 ** 0.05 *** 0.01)  ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N, fmt(%9.0gc %9.2gc) label("N")) coefl(NIE:r1vs0.attackbin "Nat. indirect effect" TE:r1vs0.attackbin "Total effect") replace tex
esttab share_fear_attack share_trust_attack, cells(b(fmt(2))) varwidth(25) noobs coefl(_nl_1  "Proportion mediated") tex




//// Appendix ////


// Figure A1

* the figure was created with a graphics program and is not part of the replication package


// Table A1

use "Violent_Conflict_Healthcare_Ind.dta", clear

estpost summarize age gender2 gender1 edu1-edu9 employed2 employed1 tpol fear_violence meduse physically_attacked nightlights marketaccess statereach spei pop edufem latitude longitude dpt3cov100 mortU1100 mortU5100 ors ucdpdeathsbin acledeventsbin
label variable nightlights "DMSP nightlights"
label variable marketaccess "Market access"
label variable statereach "State reach"
label variable spei "SPEI"
label variable pop "Population"
label variable edufem "Female education"
label variable latitude "Latitude"
label variable longitude "Longitude"
label variable dpt3cov100 "DPT-3 vaccination coverage"
label variable mortU1100 "Infant mortality rate"
label variable ors "ORS coverage"
label variable ucdpdeathsbin "Viol.\ exp.\ UCDP"
label variable acledeventsbin "Viol.\ exp.\ ACLED"
esttab ., cells("mean(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2)) count(fmt(0))")  nonumber varwidth(45) wrap replace label noobs 


// Table A2

* the figure was directly typeset in the document and is not part of the replication packages


// Table A3

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo trust_ucdp: 			reghdfe tpol ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust_attack: 		reghdfe tpol physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_trust: 	reghdfe meduse100 tpol $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace	 
eststo dpt3cov_trust: 		mixed dpt3cov100 tpol  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_healthcare: 	mixed mortU1100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_dpt3cov: 	mixed mortU1100 dpt3cov  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust_ucdp fear_ucdp trust_attack fear_attack wohealthc_fear wohealthc_trust dpt3cov_trust mortU1_healthcare mortU1_dpt3cov,  ///
	order(ucdpdeathsbin physically_attacked fear_violence tpol meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N nunits, fmt(%9.0gc %9.0gc) label("N observations" "N fixed/random effects")) replace 

		
// Table A4

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo semucdp: sem (ucdpdeathsbin -> tpol, ) (ucdpdeathsbin -> fear_violence, ) (meduse -> mortU1, ) (tpol -> meduse, ) (tpol -> dpt3cov, ) (fear_violence -> meduse, ) (dpt3cov -> mortU1, ), method(mlmv) vce(cluster gid)  nocapslatent
esttab semucdp, unstack order(ucdpdeathsbin tpol fear_violence meduse mortU1 dpt3cov) keep(ucdpdeathsbin tpol fear_violence meduse mortU1 dpt3cov) beta b(%9.2f) varwidth(45)  wrap star(* 0.1 ** 0.05 *** 0.01) tex label ///
		 sfmt(%9.2f) se compress nogaps mlabels(,none) stats(N, fmt(%9.0gc) label("N")) replace 

eststo semattacked:  sem (physically_attacked -> tpol, ) (physically_attacked -> fear_violence, ) (meduse -> mortU1, ) (tpol -> meduse, ) (tpol -> dpt3cov, ) (fear_violence -> meduse, ) (dpt3cov -> mortU1, ), method(mlmv) vce(cluster gid) nocapslatent
esttab semattacked, unstack order(physically_attacked tpol fear_violence meduse mortU1 dpt3cov) keep(physically_attacked tpol fear_violence meduse mortU1 dpt3cov) beta b(%9.2f) varwidth(45)  wrap star(* 0.1 ** 0.05 *** 0.01) tex label ///
		 sfmt(%9.2f) se compress nogaps mlabels(,none) stats(N, fmt(%9.0gc) label("N")) replace 


// Figure A2

use "Violent_Conflict_Healthcare_Grid.dta", clear

twoway (lpolyci mortU1 year if acledeventsbin==0,  bw(1)) ///
		(lpolyci mortU1  year if acledeventsbin==1,  bw(1) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Infant mortality rate")  ylabel(.045(0.005)0.07, nogrid format(%04.3f)) xtitle("") xlabel(2005(2)2015) ///
		name(mortU1_acled, replace))
graph display mortU1_acled, ysize(1.25) xsize(1) scale(1.25) 

twoway (lpolyci dpt3cov year if acledeventsbin==0,  bw(1)) ///
		(lpolyci dpt3cov  year if acledeventsbin==1,  bw(1) ///
		legend(pos(4) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)		///
		ytitle("DPT3 vaccination rate")  ylabel(.5(0.05).75, nogrid format(%03.2f)) xtitle("") xlabel(2005(2)2015) ///
		name(dpt3cov_acled, replace))
graph display dpt3cov_acled, ysize(1.25) xsize(1) scale(1.25) 

use "Violent_Conflict_Healthcare_Ind.dta", clear

twoway (lpolyci fear_violence  year if acledeventsbin==0,  bw(3)) ///
		(lpolyci fear_violence  year if acledeventsbin==1,  bw(3) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Fear of violence")  ylabel(.6(0.1)1.1, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(fear_acled, replace))
graph display fear_acled, ysize(1.25) xsize(1) scale(1.25) 

twoway (lpolyci tpol  year if acledeventsbin==0,  bw(3)) ///
		(lpolyci tpol  year if acledeventsbin==1,  bw(3) ///
		legend(pos(1) ring(0) col(1) order(2 "No armed violence" 4 "Exposed to armed violence" ) size(small)) lpattern(dash) ///
		ytitle("Political trust")  ylabel(1.4(0.1)1.9, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(pol_trust_acled, replace))
graph display pol_trust_acled, ysize(1.25) xsize(1) scale(1.25) 

twoway (lpolyci meduse  year if acledeventsbin==0,  bw(3)) ///
		(lpolyci meduse  year if acledeventsbin==1,  bw(3) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small))	lpattern(dash)	///
		ytitle("Frequency of healthcare use")  ylabel(2.7(0.1)3.2, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(meduse_acled, replace))
graph display meduse_acled, ysize(1.25) xsize(1) scale(1.25) 


// Figure A3

sembuilder "sem_acled.stsem"


// Table A5

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo semacled: sem (acledeventsbin -> tpol, ) (acledeventsbin -> fear_violence, ) (meduse -> mortU1, ) (tpol -> meduse, ) (tpol -> dpt3cov, ) (fear_violence -> meduse, ) (dpt3cov -> mortU1, ), method(mlmv) vce(cluster gid) standardized nocapslatent
esttab semacled, unstack order(acledeventsbin tpol fear_violence meduse mortU1 dpt3cov) keep(acledeventsbin tpol fear_violence meduse mortU1 dpt3cov) beta b(%9.2f) varwidth(45)  wrap star(* 0.1 ** 0.05 *** 0.01) tex label ///
		 sfmt(%9.2f) se compress nogaps mlabels(,none) stats(N, fmt(%9.0gc) label("N")) replace 
	
		
// Table A6

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo trust_acled: reghdfe tpol acledeventsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_acled: 	reghdfe fear_violence acledeventsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace

esttab trust_acled fear_acled,  ///
	keep(acledeventsbin) ///
	order(acledeventsbin) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(controls N nunits, fmt(%3s %9.0gc %9.0gc) label("Controls" "N observations" "N fixed/random effects")) replace 


// Table A7

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo did2s_trust_acled: did2s tpol, first_stage($controls i.gid i.year) second_stage(acledeventsbin) treatment(ny_treated_t_acled) cluster(id) 
estadd local controls "Yes", replace
eststo did2s_fear_acled: did2s fear_violence, first_stage($controls i.gid i.year) second_stage(acledeventsbin) treatment(ny_treated_t_acled) cluster(id)
estadd local controls "Yes", replace
esttab did2s_trust_acled did2s_fear_acled,  ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(controls N nunits, fmt(%3s %9.0gc %9.0gc) label("Controls" "N observations" "N fixed effects")) replace 

		 
// Table A8

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo med_fear_acled: mediate (meduse $controls i.year) (fear_violence $controls tpol i.year) (acledeventsbin), vce(cluster gid)
eststo share_fear_acled: nlcom _b[NIE:r1vs0.acledeventsbin]/_b[TE:r1vs0.acledeventsbin],  post
eststo med_trust_acled: mediate (meduse $controls  i.year) (tpol $controls fear_violence i.year) (acledeventsbin), vce(cluster gid)
eststo share_trust_acled: nlcom _b[NIE:r1vs0.acledeventsbin]/_b[TE:r1vs0.acledeventsbin],  post

esttab med_fear_acled med_trust_acled,  keep(NIE:r1vs0.acledeventsbin TE:r1vs0.acledeventsbin) varwidth(25) wrap star(* 0.1 ** 0.05 *** 0.01)  ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N, fmt(%9.0gc %9.2gc) label("N")) coefl(NIE:r1vs0.acledeventsbin "Nat. indirect effect" TE:r1vs0.acledeventsbin "Total effect") replace tex
esttab share_fear_acled share_trust_acled, cells(b(fmt(2))) varwidth(25) noobs coefl(_nl_1  "Proportion mediated") tex
	 

// Table A9

use "Violent_Conflict_Healthcare_Ind.dta", clear

keep if conflict_deaths_200==1
eststo clear
eststo trust200_ucdp: 			reghdfe tpol ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear200_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust200_attack: 		reghdfe tpol physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear200_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc200_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc200_trust: 	reghdfe meduse100 tpol $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo mortU1200_dpt3cov: 		reghdfe mortU1100 dpt3cov  $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
* multilevel models
eststo dpt3cov200_trust: 		mixed dpt3cov100 tpol  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1200_healthcare: 	mixed mortU1100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust200_ucdp fear200_ucdp trust200_attack fear200_attack wohealthc200_fear wohealthc200_trust dpt3cov200_trust mortU1200_healthcare mortU1200_dpt3cov, ///
	order(ucdpdeathsbin physically_attacked fear_violence tpol meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N nunits, fmt(%9.0gc %9.0gc) label("N observations" "N fixed/random effects")) replace tex


// Table A10

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo trust_ucdp: 			reghdfe tpol ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust_attack: 		reghdfe tpol physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_trust: 	reghdfe meduse100 tpol $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo dpt3cov_trust: 		mixed dpt3cov tpol  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU5_healthcare: 	mixed mortU5100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU5_dpt3cov: 	mixed mortU5100 dpt3cov  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust_ucdp fear_ucdp trust_attack fear_attack wohealthc_fear wohealthc_trust dpt3cov_trust mortU5_healthcare mortU5_dpt3cov,  ///
	order(ucdpdeathsbin physically_attacked fear_violence tpol meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N nunits, fmt(%9.0gc %9.0gc) label("N observations" "N fixed/random effects")) replace 
		 
			
// Figure A4

use "Violent_Conflict_Healthcare_Grid.dta", clear

twoway (lpolyci mortU5 year if ucdpdeathsbin==0,  bw(1)) ///
		(lpolyci mortU5  year if ucdpdeathsbin==1,  bw(1) ///
		legend(pos(1) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)	///
		ytitle("Child mortality rate")  ylabel(.06(0.01)0.11, nogrid format(%03.2f)) xtitle("") xlabel(2005(2)2015) ///
		name(mortU5_ucdp, replace))
graph display mortU5_ucdp, ysize(1.25) xsize(1) scale(1.1) 

use "Violent_Conflict_Healthcare_Ind.dta", clear

twoway (lpolyci tinst  year if ucdpdeathsbin==0,  bw(3)) ///
		(lpolyci tinst  year if ucdpdeathsbin==1,  bw(3) ///
		legend(pos(4) ring(0) col(1) order(2 "No armed violence" 4 "Exposed to armed violence" ) size(small)) lpattern(dash) ///
		ytitle("Institutional trust")  ylabel(1.2(0.1)1.8, nogrid format(%03.1f)) xtitle("") xlabel(2005(2)2015) ///
		name(inst_trust_ucdp, replace))
graph display inst_trust_ucdp, ysize(1.25) xsize(1) scale(1.1) 

use "Violent_Conflict_Healthcare_Grid.dta", clear

twoway (lpolyci ors100 year if ucdpdeathsbin==0,  bw(1)) ///
		(lpolyci ors100  year if ucdpdeathsbin==1,  bw(1) ///
		legend(pos(4) ring(0) col(1) lab(2 "No armed violence") lab(4 "Exposed to armed violence") order(2 4) size(small)) lpattern(dash)		///
		ytitle("ORS coverage") ylabel(.15(0.05).40, nogrid format(%03.2f)) xtitle("") xlabel(2005(2)2015)  ///
		name(ors_ucdp, replace))
graph display ors_ucdp, ysize(1.25) xsize(1) scale(1.1) 	
		

// Table A11

use "Violent_Conflict_Healthcare_Ind.dta", clear

eststo clear
eststo trust_ucdp: 			reghdfe tinst ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust_attack: 		reghdfe tinst physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_trust: 	reghdfe meduse100 tinst $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo dpt3cov_trust: 		mixed dpt3cov100 tinst  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_healthcare: 	mixed mortU1100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_dpt3cov: 	mixed mortU1100 dpt3cov  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust_ucdp fear_ucdp trust_attack fear_attack wohealthc_fear wohealthc_trust dpt3cov_trust mortU1_healthcare mortU1_dpt3cov,  ///
	order(ucdpdeathsbin physically_attacked fear_violence tinst meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N nunits, fmt(%9.0gc %9.0gc) label("N observations" "N fixed/random effects")) replace tex


// Table A12

use "Violent_Conflict_Healthcare_Ind.dta", clear

* TWFE models
eststo clear
eststo trust_ucdp: 			reghdfe tpol ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_ucdp: 			reghdfe fear_violence ucdpdeathsbin $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo trust_attack: 		reghdfe tpol physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo fear_attack: 		reghdfe fear_violence physically_attacked $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_fear: 		reghdfe meduse100 fear_violence $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
eststo wohealthc_trust: 	reghdfe meduse100 tpol $controls, absorb(i.gid i.year) vce(cluster gid)
estadd scalar nunits e(N_clust1), replace
estadd local controls "Yes", replace
* multilevel models
eststo ors_trust: 		mixed ors100 tpol  $controls ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_healthcare: 	mixed mortU1100 meduse1  $controls  ||gid:, vce(cluster gid)	
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace
eststo mortU1_ors: 		mixed mortU1100 ors  $controls ||gid:, vce(cluster gid)
estadd scalar nunits e(N_clust), replace
estadd local controls "Yes", replace

esttab trust_ucdp fear_ucdp trust_attack fear_attack wohealthc_fear wohealthc_trust mortU1_ors ors_trust mortU1_healthcare,  ///
	order(ucdpdeathsbin physically_attacked fear_violence tpol meduse1 dpt3cov) ///
	varwidth(45) lab wrap star(* 0.1 ** 0.05 *** 0.01) tex ///
		b(%9.3f) sfmt(%9.3gc) se compress nogaps stats(N nunits, fmt(%9.0gc %9.0gc) label("N observations" "N fixed/random effects"))  
	
